#pragma once

#include <gl\glew.h>
#include <string>
#include <fstream>
using namespace std;

class CShader
{
public:
	CShader()	{				}
	~CShader()
	{ 
		ReleaseShader();	
	}

	string LoadTextFile(string strFile);
	void InitShaders(string strVertex, string strFragment);
	GLint GetVariable(string strVariable);
	GLuint  GetProgram()	{	return m_hProgramObject; }
	GLuint  GetVertexS()	{	return m_hVertexShader; }
	GLuint  GetFragmentS()	{	return m_hFragmentShader; }
	void SetInt(GLint variable, int newValue)								{ glUniform1iARB(variable, newValue);		}
	void SetFloat(GLint variable, float newValue)							{ glUniform1fARB(variable, newValue);		}
	void SetFloat2(GLint variable, float v0, float v1)						{ glUniform2fARB(variable, v0, v1);			}
	void SetFloat3(GLint variable, float v0, float v1, float v2)			{ glUniform3fARB(variable, v0, v1, v2);		}
	void SetFloat4(GLint variable, float v0, float v1, float v2, float v3)	{ glUniform4fARB(variable, v0, v1, v2, v3);	}
	void TurnOn()		{	glUseProgram(m_hProgramObject); }
	void TurnOff()		{	glUseProgram(0);				 }
	void ReleaseShader();
	void printShaderInfoLog(unsigned int shader);
	void printProgramInfoLog();

private:
	GLuint  m_hVertexShader;
	GLuint  m_hFragmentShader;
	GLuint  m_hProgramObject;
};


// check compatibility
bool InitGLSL();
